const routes = [
  {
    path: '/',
    component: () => import('layouts/LoginLayout.vue'),
    children: [
      { path: '', redirect: '/tLogin' },
      { path: 'mLogin', component: () => import('src/pages/login/manager.vue') },
      { path: 'tLogin', component: () => import('src/pages/login/tenant.vue') }
    ]
  },
  {
    path: '/main',
    component: () => import('src/layouts/MainLayout.vue'),
    children: [
      { path: '', redirect: '/main/index' },
      { path: 'index', component: () => import('pages/dashboard/index.vue') },

      {
        path: 'tenant',
        component: () => import('pages/manager/tenant/index.vue'),
        children: [
          { path: '', redirect: '/main/tenant/list' },
          { path: 'list', component: () => import('pages/manager/tenant/list.vue') },
          { path: 'detail/:id', component: () => import('pages/manager/tenant/detail.vue') }
        ]
      },

      {
        path: 'payment',
        component: () => import('pages/manager/payment/index.vue'),
        children: [
          { path: '', redirect: '/main/payment/list' },
          { path: 'list', component: () => import('pages/manager/payment/list.vue') },
          { path: 'detail/:id', component: () => import('pages/manager/payment/detail.vue') }
        ]
      },

      {
        path: 'consumer',
        component: () => import('pages/manager/consumer/index.vue'),
        children: [
          { path: '', redirect: '/main/consumer/list' },
          { path: 'list', component: () => import('pages/manager/consumer/list.vue') },
          { path: 'detail/:id', component: () => import('pages/manager/consumer/detail.vue') }
        ]
      },

      {
        path: 'shop',
        component: () => import('pages/tenant/shop/index.vue'),
        children: [
          { path: '', redirect: '/main/shop/detail' },
          { path: 'detail', component: () => import('pages/tenant/shop/detail.vue') }
        ]
      },

      {
        path: 'material',
        component: () => import('pages/tenant/material/index.vue'),
        children: [
          { path: '', redirect: '/main/material/list' },
          { path: 'list', component: () => import('pages/tenant/material/list.vue') },
          { path: 'import', component: () => import('pages/tenant/material/import.vue') },
          { path: 'detail/:id', component: () => import('pages/tenant/material/detail.vue') }
        ]
      },

      {
        path: 'customer',
        component: () => import('pages/tenant/customer/index.vue'),
        children: [
          { path: '', redirect: '/main/customer/list' },
          { path: 'list', component: () => import('pages/tenant/customer/list.vue') },
          { path: 'detail/:id', component: () => import('pages/tenant/customer/detail.vue') }
        ]
      },

      {
        path: 'device',
        component: () => import('pages/tenant/device/index.vue'),
        children: [
          { path: '', redirect: '/main/device/list' },
          { path: 'list', component: () => import('pages/tenant/device/list.vue') },
          { path: 'detail/:id', component: () => import('pages/tenant/device/detail.vue') }
        ]
      },

      {
        path: 'sale',
        component: () => import('pages/tenant/sale/index.vue'),
        children: [
          { path: '', redirect: '/main/sale/list' },
          { path: 'list', component: () => import('pages/tenant/sale/list.vue') },
          { path: 'detail/:id', component: () => import('pages/tenant/sale/detail.vue') }
        ]
      },

      {
        path: 'delivery',
        component: () => import('pages/tenant/delivery/index.vue'),
        children: [
          { path: '', redirect: '/main/delivery/list' },
          { path: 'list', component: () => import('pages/tenant/delivery/list.vue') },
          { path: 'detail/:id', component: () => import('pages/tenant/delivery/detail.vue') }
        ]
      },

      { path: 'user', component: () => import('src/pages/system/user.vue') },
      { path: 'log', component: () => import('src/pages/system/log.vue') }
    ]
  },

  {
    path: '/share',
    component: () => import('layouts/ShareLayout.vue'),
    children: [
      { path: 'delivery/:id', component: () => import('src/pages/share/delivery.vue') }
    ]
  },

  {
    path: '/shop',
    component: () => import('layouts/shopLayout.vue'),
    children: [
      { path: ':id/list', component: () => import('src/pages/shop/list.vue') },
      { path: 'detail/:id', component: () => import('src/pages/shop/detail.vue') },
      { path: 'login', component: () => import('src/pages/shop/login.vue') },
      { path: 'order', component: () => import('src/pages/shop/order.vue') },
      { path: 'profile', component: () => import('src/pages/shop/profile.vue') },
      { path: 'setting', component: () => import('src/pages/shop/setting.vue') },
      { path: 'editor', component: () => import('src/pages/shop/editor.vue') }
    ]
  },

  {
    path: '/cockpit',
    component: () => import('layouts/cockpitLayout.vue'),
    children: [
      { path: 'c_delivery', component: () => import('src/pages/cockpit/delivery.vue') }
    ]
  },

  // Always leave this as last one,
  // but you can also remove it
  {
    path: '/:catchAll(.*)*',
    component: () => import('pages/ErrorNotFound.vue')
  }
]

export default routes
